(: Ex1 :)
<Countries_of_the_Danube>
{
(: 
   opening xml database mondial-europe
   getting river node with name child node equals to Donau
   getting country attribute
   split string in token base on space character
:)
let $x := tokenize(doc('/db/mondial/mondial-europe.xml')/mondial/river[name='Donau']/@country, "\s")
(: 
   getting countries with attribute car_code in the tokenized string retrieved before
   ordered alphabetically 
:)
for $c in doc('/db/mondial/mondial-europe.xml')/mondial/country
where $c/@car_code = $x
order by $c/name ascending
(: return child node name of these countries :)
return $c/name
}
</Countries_of_the_Danube>

